package exception;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * @author げっしょく
 * @date 2021/7/23
 */
public class ScannExce {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<String> arr = new ArrayList<>();
        int a = 0;
        while (true) {
            System.out.println("请输入你的年龄，只能输入16-25：");
            a = sc.nextInt();
            if(a >= 16 && a <= 25){
                break;
            }
        }
        System.out.println(a);
    }
}

class AgeOut extends RuntimeException{
    public AgeOut() {
    }

    public AgeOut(String message) {
        super(message);
    }
}
